<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class Pagetemplates extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		//
		DB::table("page_templates")
			->where("name","home")
			->update(["title"=>"Home Page"]);

		DB::table("page_templates")
			->where("name","internal")
			->update(["name"=>"content", "title"=>"Content Page"]);

		DB::table("page_templates")
			->insert([
				["name"=>"products", "title"=>"Products Page"],
				["name"=>"news", "title"=>"News Page"],
				["name"=>"projects", "title"=>"Projects Page"],
				["name"=>"videos", "title"=>"Videos Page"],
				["name"=>"jobs", "title"=>"Jobs Page"]
			]);
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
		DB::table("page_templates")
			->whereIn('name', ["products", "news", "projects", "videos", "jobs"])->delete();

		DB::table("page_templates")
			->where("name","content")
			->update(["name"=>"internal", "title"=>"Internal Template"]);

		DB::table("page_templates")
			->where("name","home")
			->update(["title"=>"Home Template"]);

		DB::statement("alter table page_templates auto_increment = 2");
	}

}
